import { createSlice } from "@reduxjs/toolkit";
import { RootState } from "../index";

interface loginState {
  loginState: boolean;
}

const initialState: loginState = {
  loginState: false,
};

const loginStore = createSlice({
  name: "login",
  initialState,
  reducers: {
    changeLoginState(state, action) {
      state.loginState = action.payload;
    },
  },
});

export const selectLogin = (state: RootState) => state.login.loginState;
export const { changeLoginState } = loginStore.actions;
export default loginStore.reducer;